package com.iflytek.jcy.supervise.clue.common.enums;

/**
 * 任务相关的枚举类
 */
public enum TaskEnum  {
    BEHAVIOR_CREATE(1, "创建任务"),
    BEHAVIOR_EXCUTE(2, "执行任务"),

    TASK_RUN_STATUS_SUCCESS(1,"执行成功"),
    TASK_RUN_STATUS_EXCEPTION(2,"执行异常"),
    TASK_RUN_STATUS_STOPPED(3,"任务中断"),
    TASK_RUN_STATUS_RUNNING(4,"执行中"),
    
    TASK_STATUS_RUNNING(1,"运行中"),
    TASK_STATUS_OVER(2,"运行完毕"),
    TASK_STATUS_STOP(3,"运行中止"),
    
    
    ;

    private Integer code;
    private String desc;

    TaskEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static TaskEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }

        for (TaskEnum anEnum : values()) {
            if (anEnum.getCode().equals(code)) {
                return anEnum;
            }
        }

        return null;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}